﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using weikebuluo.Model;
using weikebuluo.DAL;
using System.Data;

namespace weikebuluo.web.wechat.party
{
    public partial class publish_activity : System.Web.UI.Page
    {
        p_active_dal activedal = new p_active_dal();
        p_active_model activemodel = new p_active_model();

        protected void Page_Load(object sender, EventArgs e)
        {
            switch (Request.Form["action"]) { 
                case "one":
                    add();
                    break;
            }
        }

        private void add() {
            activemodel.active_theme = Request.Form["name"];
            activemodel.active_address = Request.Form["address"];
            activemodel.active_address1 = Request.Form["setAddress"];
            activemodel.active_time = DateTime.Parse(Request.Form["day"].ToString());
            activemodel.active_hour = int.Parse(Request.Form["time"]);
            activemodel.active_content = Request.Form["info"];

            activemodel.active_name = Request.Form["truename"];
            activemodel.active_phone = Request.Form["tel"];

            activemodel.wxid = Request.Form["wxid"];
            activemodel.user_id = int.Parse(Request.Form["uid"]);
            activedal.Add(activemodel);

            Response.Write("<script Language=\"Javascript\">alert(\"活动添加成功！\")");
            Response.Write("</script>");
            Response.Write("<script Language=\"Javascript\">location.href=\"active_list.aspx?uid=" + Request.Form["uid"] + "&wxid=" + Request.Form["wxid"] + "\";");
            Response.Write("</script>");
            Response.End();
        }
    }
}